{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e8356c95",
   "metadata": {},
   "source": [
    "--------\n",
    "* 2023-10-09\n",
    "* 课程：python语言\n",
    "* week05\n",
    "--------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e1c74f31",
   "metadata": {},
   "source": [
    "# 1.用户输入\n",
    "\n",
    "> 1.input\n",
    "\n",
    "> 2.input输入的数据类型是：string\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "982221b1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name:siqi\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'siqi'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "input(\"name:\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6afb94f8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入用户名siqi\n",
      "请输入密码liang88228830\n"
     ]
    }
   ],
   "source": [
    "username = input(\"请输入用户名\")\n",
    "password = input(\"请输入密码\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "89806180",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "siqi\n"
     ]
    }
   ],
   "source": [
    "print(username)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "91ed9c56",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "liang88228830\n"
     ]
    }
   ],
   "source": [
    "print(password)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e57978ad",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "欢迎尊贵的VVVIP用户登录！\n"
     ]
    }
   ],
   "source": [
    "# 用户登录\n",
    "if username == 'siqi' and password == 'liang88228830':\n",
    "    print(\"欢迎尊贵的VVVIP用户登录！\")\n",
    "else: \n",
    "    print(\"账号或密码不正确，请重试！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d6e14336",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入用户名：siqi\n",
      "请输入密码：liang88228834\n",
      "账号或密码不正确，请重新尝试！！\n"
     ]
    }
   ],
   "source": [
    "# 用户注册\n",
    "username = input(\"请输入用户名：\")\n",
    "password = input(\"请输入密码：\")\n",
    "# 用户登录\n",
    "if username == \"siqi\" and password ==\"liang88228830\":\n",
    "    print(\"欢迎尊贵的VVVIP用户登录！！\")\n",
    "else:\n",
    " print(\"账号或密码不正确，请重新尝试！！\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5e7ceae5",
   "metadata": {},
   "source": [
    "# 2.用户规范化/格式化输入"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "b643cef2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入你的姓名：siqi\n",
      "输入你的年龄：19\n",
      "输入你的职业：student\n",
      "输入你的工资：100000000000\n",
      "——INFO siqi——\n",
      "姓名是:siqi\n",
      "年龄是:19\n",
      "职业是:student \n",
      "工资是:100000000000 \n"
     ]
    }
   ],
   "source": [
    "# 输入的内容\n",
    "name = input(\"输入你的姓名：\")\n",
    "age = input(\"输入你的年龄：\")\n",
    "job = input(\"输入你的职业：\")\n",
    "salary = input(\"输入你的工资：\")\n",
    "\n",
    "# info为展示的数据\n",
    "info = \"\"\"——INFO %s——\n",
    "姓名是:%s\n",
    "年龄是:%s\n",
    "职业是:%s \n",
    "工资是:%s \"\"\"%(name,name,age,job,salary)\n",
    "\n",
    "# 打印结果\n",
    "print(info)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fd7106ad",
   "metadata": {},
   "source": [
    "* 占位符：\n",
    ">  1.顺序\n",
    "\n",
    ">  2.%s代表字符串%d 代表数字（整数）f%代表小数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b89df626",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入你的姓名：siqi\n",
      "输入你的年龄：asa\n",
      "输入你的职业：dsda\n",
      "输入你的工资：asdsa\n",
      "——INFO siqi——\n",
      "姓名是:siqi\n",
      "年龄是:asa\n",
      "职业是:dsda\n",
      "工资是:asdsa \n"
     ]
    }
   ],
   "source": [
    "# 输入的内容（后端）\n",
    "name = input(\"输入你的姓名：\")\n",
    "age = input(\"输入你的年龄：\")\n",
    "job = input(\"输入你的职业：\")\n",
    "salary = input(\"输入你的工资：\")\n",
    "\n",
    "# info为展示的数据（前端）\n",
    "info = \"\"\"——INFO {N}——\n",
    "姓名是:{N}\n",
    "年龄是:{A}\n",
    "职业是:{J}\n",
    "工资是:{S} \"\"\".format(N=name,J=job,S=salary,A=age)\n",
    "\n",
    "# 打印结果\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5530d219",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
